package org.example.api.admin;

import org.example.R.R;
import org.example.entity.dto.AddNoticeDto;
import org.example.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@RequestMapping("/api/admin/notice")
public class NoticeController {

    @Autowired
    private NoticeService noticeService;

    @PostMapping("/add")
    public R add(@Valid @RequestBody AddNoticeDto dto){
        return noticeService.add(dto);
    }

    @PostMapping("/delete")
    public R delete(@RequestParam("id") Long id){
        return noticeService.delete(id);
    }

    @PostMapping("/list")
    public R list(){
        return noticeService.list();
    }

    @PostMapping("/detail")
    public R pcNoticeDetail(@RequestParam("id") Long id){
        return noticeService.pcNoticeDetail(id);
    }

    @PostMapping("/user_list")
    public R listImportUser(){
        return noticeService.userListImport();
    }

    @PostMapping("/dw_jw_list")
    public R listImportDwJf(){
        return noticeService.dwJwListImport();
    }

}
